package com.uls.ldcm.service.impl;

import java.util.List;

import com.uls.common.utils.DateUtils;
import com.uls.common.utils.SecurityUtils;
import com.uls.ldcm.domain.Contracts;
import com.uls.ldcm.domain.Salarypayments;
import com.uls.ldcm.mapper.ContractsMapper;
import com.uls.ldcm.mapper.SalarypaymentsMapper;
import com.uls.ldcm.service.IContractsService;
import com.uls.ldcm.service.ISalarypaymentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.uls.ldcm.mapper.SalaryschemesMapper;
import com.uls.ldcm.domain.Salaryschemes;
import com.uls.ldcm.service.ISalaryschemesService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 薪资方案Service业务层处理
 * 
 * @author gw
 * @date 2024-10-31
 */
@Service
public class SalaryschemesServiceImpl implements ISalaryschemesService 
{
    @Autowired
    private SalaryschemesMapper salaryschemesMapper;

    /**
     * 查询薪资方案
     * 
     * @param salaryschemeId 薪资方案主键
     * @return 薪资方案
     */
    @Override
    public Salaryschemes selectSalaryschemesBySalaryschemeId(Long salaryschemeId)
    {
        return salaryschemesMapper.selectSalaryschemesBySalaryschemeId(salaryschemeId);
    }

    /**
     * 查询薪资方案列表
     * 
     * @param salaryschemes 薪资方案
     * @return 薪资方案
     */
    @Override
    public List<Salaryschemes> selectSalaryschemesList(Salaryschemes salaryschemes)
    {
        return salaryschemesMapper.selectSalaryschemesList(salaryschemes);
    }

    @Override
    public Salaryschemes selectSalaryschemesByLaborerId(Long LaborerId) {
        return salaryschemesMapper.selectSalaryschemesByLaborerId(LaborerId);
    }


    /**
     * 新增薪资方案
     * 
     * @param salaryschemes 薪资方案
     * @return 结果
     */
    @Override
    public int insertSalaryschemes(Salaryschemes salaryschemes)
    {
        salaryschemes.setCreatedAt(DateUtils.getNowDate());
        salaryschemes.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
        return salaryschemesMapper.insertSalaryschemes(salaryschemes);
    }

    /**
     * 修改薪资方案
     * 
     * @param salaryschemes 薪资方案
     * @return 结果
     */
    @Transactional
    @Override
    public int updateSalaryschemes(Salaryschemes salaryschemes)
    {
        salaryschemes.setCreatedAt(DateUtils.getNowDate());
        salaryschemes.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
        return salaryschemesMapper.updateSalaryschemes(salaryschemes);
    }

    /**
     * 批量删除薪资方案
     * 
     * @param salaryschemeIds 需要删除的薪资方案主键
     * @return 结果
     */
    @Override
    public int deleteSalaryschemesBySalaryschemeIds(Long[] salaryschemeIds)
    {
        return salaryschemesMapper.deleteSalaryschemesBySalaryschemeIds(salaryschemeIds);
    }

    /**
     * 删除薪资方案信息
     * 
     * @param salaryschemeId 薪资方案主键
     * @return 结果
     */
    @Override
    public int deleteSalaryschemesBySalaryschemeId(Long salaryschemeId)
    {
        return salaryschemesMapper.deleteSalaryschemesBySalaryschemeId(salaryschemeId);
    }
}
